package pers.liyan.shi.springboot.mapper;

import org.apache.ibatis.annotations.*;
import pers.liyan.shi.springboot.bean.Employee;

public interface EmployeeMapper {

    @Select("select * from employee where id = #{id}")
    Employee getEmpById(Integer id);

    @Update("update employee set lastName=#{lastName}, email = #{email}, gender = #{gender}, d_id = #{dId} where id = #{id}")
    int updateEmp(Employee employee);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into employee (lastName, email, gender, d_id) values (#{lastName}, #{email}, #{gender}, #{dId})")
    int insertEmp(Employee employee);

    @Delete("delete from employee where id = #{id}")
    int deleteEmpById(Integer id);

    @Select("select * from employee where lastName = #{lastName}")
    Employee getEmpByLastName(String lastName);


}
